package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 需求:
 * 在demo包下新建一个类:Person,并在类中添加一个方法:sayHi
 *
 * 创建Spring容器，并向容器获取一个Person对象，随后调用sayHi方法
 */
public class Test {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo1");
        Person person = context.getBean(Person.class);
        person.sayHi();

        User user = context.getBean(User.class);
        user.sayHello();
    }
}
